package com.example.text.controller;


import com.example.text.entity.Inware;
import com.example.text.entity.Result;
import com.example.text.entity.Ware;
import com.example.text.service.InWareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;



@RestController
@RequestMapping("/api/in")
public class InWareController {

    @Autowired
    private InWareService inWareService;

    //查询全部
    @GetMapping("/selectAllOrder")
    public Result selectAll(){
        List<Inware> inwareList = inWareService.selectAllOrder();
        return  Result.success(inwareList);
    }

    //根据订单号查询
    @GetMapping("/selectByOrder/{InWareOrder}")
    public Result selectByOrder(@PathVariable String InWareOrder) {
        Inware inware =inWareService.selectByOrder(InWareOrder);
        return Result.success(inware);

    }

    //逻辑删除
    @PostMapping("/delete/{InWareId}")
    public Result delete(@PathVariable Integer InWareId){
        inWareService.deleteOrder(InWareId);
        return Result.success();
    }



    //新增
    @PostMapping("/add")
    public Result add(@RequestBody Inware inware){
        inWareService.insertWare(inware);
        return Result.success();
    }






}
